package com.beidouin.sensortest;

import com.friendlyarm.AndroidSDK.HardwareControler;

/**
 * Created by Ziji on 2017/8/20.
 */

public class AM2320 {
    static public int AM2320_Init(int devFD)
    {
        if(HardwareControler.setI2CSlave(devFD,(byte)(0xB8)>>1)<0)//设置I2c通信硬件地址
        {
            return -1;
        }
        return 0;
    }

    static public int[] AM2320_read(int devFD)
    {
        int[] data=new int[4];
        HardwareControler.writeByteDataToI2C(devFD,0x03, (byte) 0x00);
        data[0]= HardwareControler.I2CReadByteData(devFD,0x00,100);
        data[1]= HardwareControler.I2CReadByteData(devFD,0x01,100);
        data[2]= HardwareControler.I2CReadByteData(devFD,0x02,100);
        data[3]= HardwareControler.I2CReadByteData(devFD,0x03,100);
        return data;
    }
}
